package com.platform.hjt.base.service;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import com.platform.hjt.base.costant.SessionConstant;
import com.platform.hjt.sys.model.SysCompanyInfo;
import com.platform.hjt.sys.model.SysDept;
import com.platform.hjt.sys.model.SysUserInfo;

public class BaseService {
	@Resource
	private  HttpServletRequest request;
	
	public SysUserInfo getSessionUserInfo(){
		return (SysUserInfo)request.getSession().getAttribute(SessionConstant.SESSION_USER);
	}
	
	public void setSessionUserInfo(SysUserInfo userInfo){
		request.getSession().setAttribute(SessionConstant.SESSION_DEPT, userInfo.getSysDept());
		request.getSession().setAttribute(SessionConstant.SESSION_USER, userInfo);
	}
	
	public void setSessionCompany(SysCompanyInfo sysCompanyInfo){
		request.getSession().setAttribute(SessionConstant.SESSION_COMPANY, sysCompanyInfo);
	}
	
	public SysCompanyInfo getSessionSysCompanyInfo(){
		return (SysCompanyInfo) request.getSession().getAttribute(SessionConstant.SESSION_COMPANY);
	}
	
    protected void setSessionDept(SysDept sysDept) {
        request.getSession().setAttribute(SessionConstant.SESSION_DEPT, sysDept);
    }
	
    public SysDept getSessionDept() {
        return (SysDept) request.getSession().getAttribute(SessionConstant.SESSION_DEPT);
     }
	
	public HttpServletRequest getRequest(){
		return request;
	}
	
}
